package com.orchidea.uml.model.document
{
    public class RelationType
    {
        public static var ASSOCIATION : RelationType = new RelationType("association");
        public static var AGGREGATION : RelationType = new RelationType("aggregation");
        public static var COMPOSITION : RelationType = new RelationType("composition");
        public static var DEPENDENCY  : RelationType = new RelationType("dependency");
        public static var INHERITANCE : RelationType = new RelationType("inheritance");
        public static var REALIZATION : RelationType = new RelationType("realization");
        public static var NOTE        : RelationType = new RelationType("note");

        private var _type : String;

        public function get type():String
        {
			return _type;
		}

        public static function fromString( typeString : String ) : RelationType
        {
			var instance : RelationType = RelationType[typeString.toUpperCase()];

			if ( instance == null ) {
				throw new ArgumentError("String does not match an existing relation type: " + typeString);
			}

			return instance;
		}

        public function RelationType(type:String)
        {
            _type = type;
        }

    }
}